//package com.example.routeplansystem.entity.bo;
//
//import com.alibaba.excel.annotation.ExcelProperty;
//import com.alibaba.excel.annotation.write.style.HeadStyle;
//import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
//import com.alibaba.excel.metadata.data.WriteCellData;
//import com.example.routeplansystem.entity.po.NodePojo;
//import com.example.routeplansystem.entity.po.VehicleMessage;
//import lombok.Data;
//import lombok.EqualsAndHashCode;
//import lombok.NoArgsConstructor;
//
///**
// * @author 唐海军
// * @create 2022-07-14 16:52
// */
//
//@Data
//@NoArgsConstructor
//@EqualsAndHashCode
//// 标题的前景色设为不填充
//@HeadStyle(fillPatternType = FillPatternTypeEnum.NO_FILL)
//public class ResultExcelBo implements AutoCloseable{
//    // 导出文件中各字段为：车牌号，车辆容量，客户id，配送顺序，客户点名称，客户地址，总里程（m还是km，请确认）。
//    @ExcelProperty("车牌号")
//    private  WriteCellData<String> vehicleNumber;
//
//    @ExcelProperty("车辆容量")
//    private  WriteCellData<Float> capacity;
//
//    @ExcelProperty("客户id")
//    private  WriteCellData<Integer> customerId;
//
//    @ExcelProperty("配送顺序")
//    private  WriteCellData<Integer> order;
//
//    @ExcelProperty("客户名称")
//    private  WriteCellData<String> customerName;
//
//    @ExcelProperty("客户地址")
//    private  WriteCellData<String> customerAddress;
//
//    @ExcelProperty("总里程（单位：米）")
//    private  WriteCellData<Integer> totalDistance;
//
//
//    public ResultExcelBo(NodeExcelBO nodeExcelBO,VehicleExcelBO vehicleExcelBO){
//        this.customerId=new WriteCellData<>(nodeExcelBO.getCustomerId().toString());
//        this.customerAddress=new WriteCellData<>(nodeExcelBO.getCustomerAddress());
//        this.customerName=new WriteCellData<>(nodeExcelBO.getCustomerName());
//        this.capacity=new WriteCellData<>(Float.toString(vehicleExcelBO.getCapacity()));
//        this.vehicleNumber=new WriteCellData<>(vehicleExcelBO.getVehicleNumber());
//    }
//
//    public ResultExcelBo(NodePojo node, VehicleMessage vehicle){
//        this.customerId=new WriteCellData<>(node.getNodeId().toString());
//        this.customerAddress=new WriteCellData<>(node.getNodeAddress());
//        this.customerName=new WriteCellData<>(node.getNodeName());
//        this.capacity=new WriteCellData<>(Float.toString(vehicle.getCapacity()));
//        this.vehicleNumber=new WriteCellData<>(vehicle.getVehicleNumber());
//    }
//
//
//    @Override
//    public void close() throws Exception {
//
//    }
//}
package com.example.routeplansystem.entity.bo;

        import com.alibaba.excel.annotation.ExcelProperty;
        import com.alibaba.excel.annotation.write.style.HeadStyle;
        import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
        import com.alibaba.excel.metadata.data.WriteCellData;
        import com.example.routeplansystem.entity.po.NodePojo;
        import com.example.routeplansystem.entity.po.VehicleMessage;
        import lombok.Data;
        import lombok.EqualsAndHashCode;
        import lombok.NoArgsConstructor;

/**
 * @author 唐海军
 * @create 2022-07-14 16:52
 */

@Data
@NoArgsConstructor
@EqualsAndHashCode
// 标题的前景色设为不填充
@HeadStyle(fillPatternType = FillPatternTypeEnum.NO_FILL)
public class ResultExcelBo implements AutoCloseable{
    // 导出文件中各字段为：车牌号，车辆容量，客户id，配送顺序，客户点名称，客户地址，总里程（m还是km，请确认）。
    @ExcelProperty("车牌号")
    private String vehicleNumber;

    @ExcelProperty("车辆容量")
    private float capacity;

    @ExcelProperty("客户id")
    private Integer customerId;

    @ExcelProperty("配送顺序")
    private int order;

    @ExcelProperty("客户名称")
    private String customerName;

    @ExcelProperty("客户地址")
    private String customerAddress;

    @ExcelProperty("总里程（单位：米）")
    private int totalDistance;


    public ResultExcelBo(NodeExcelBO nodeExcelBO,VehicleExcelBO vehicleExcelBO){
        this.customerId=nodeExcelBO.getCustomerId();
        this.customerAddress=nodeExcelBO.getCustomerAddress();
        this.customerName=nodeExcelBO.getCustomerName();
        this.capacity=vehicleExcelBO.getCapacity();
        this.vehicleNumber=vehicleExcelBO.getVehicleNumber();
    }

    public ResultExcelBo(NodePojo node, VehicleMessage vehicle){
        this.customerId=node.getNodeId();
        this.customerAddress=node.getNodeAddress();
        this.customerName=node.getNodeName();
        this.capacity=vehicle.getCapacity();
        this.vehicleNumber=vehicle.getVehicleNumber();
    }


    @Override
    public void close() throws Exception {

    }
}
